home *** CD-ROM | disk | FTP | other *** search
- A N S I . S Y S
-
-
-
- There are two ways to set screen color from DOS without using one of
- the many memory resident programs available. I don't like using the
- memory resident programs because they are inevitably incompatible
- with something. Both of the 'normal' methods involve patching DOS.
- The first involves patching COMMAND.COM (instructions given below),
- and the second involves patching ANSI.SYS. If you have ansi.sys
- loaded, and you use the dos CLS command, the command is routed to
- ANSI.SYS, and not through COMMAND.COM. That is why you must patch
- ANSI.SYS for color if you intend to use it at all. Both of these
- methods are activated by the CLS command. Merely type CLS, and the
- screen changes color to whatever you have set it at. All further
- writes to the screen will be in those colors too. I prefer to use
- ANSI.SYS, for reasons which I will expound upon further. Many
- programs use ansi for output, and these programs will magically
- appear in color once you have loaded ansi.sys. ANSI.SYS supports
- screen colors, and the colors you want are changeable at any time.
- Merely include the proper 'escape' codes in your PROMPT command, and
- the screen colors will change appropriately. To use ANSI.SYS,
- include the following line in your CONFIG.SYS file:
-
- DEVICE=ANSIPACH.SYS
-
- Notice that the file is called ANSIPACH.SYS, and not ANSI.SYS. That
- is the name of the file I have included in this ARC library. It is
- already patched, and to save myself typing, I am not going to bother
- going into the nitty gritty detail of what the patch is. It does
- replace the ESC[=# command, the 'Set Mode' command as it is called.
- Since no programs use this, and the dos MODE command does the same
- thing anyway, there should be no problem. To have set the screen
- colors using ANSI.SYS, you should include the appropriate 'escape
- sequences' in your PROMPT command. Here is an excerpt from the
- DOS-3.1 Technical Reference Manual:
-
-
- Set Graphics Rendition (SGR)
-
- ESC[#,...;#m Sets the character attribute specified
- by the parameters. All following
- characters have the attribute according
- to the parameters until the next occurence
- of SGR.
-
- Parameter Meaning
- --------- -------
- 0 All attributes OFF (Normal Black on White)
- 1 Bold ON (high intensity)
- 4 Underscore ON (IBM Monochrome display only)
- 5 Blink ON
- 7 Reverse Video ON
- 8 Canceled ON (invisible text)
- 30 Black foreground
- 31 Red foreground
- 32 Green foreground
- 33 Yellow foreground
- 34 Blue foreground
- 35 Magenta foreground
- 36 Cyan foreground
- 37 White foreground
- 40 Black background
- 41 Red background
- 42 Green background
- 43 Brown background
- 44 Blue background
- 45 Magenta background
- 46 Cyan background
- 47 White background
-
-
- To set the colors using the DOS PROMPT command, just type the
- following command:
-
- PROMPT $e[#;#m$g - Where # is a number taken off of the above chart.
-
- If you like to have the current directory displayed when you are at
- dos, add $p to the command like this:
-
- PROMPT $e[#;#m$p$g
-
- For example, supposing I want the current directory displayed, and I
- would like screen colors of white on blue, I would use the command:
-
- PROMPT $e[37;44m$p$g
-
- If I wanted yellow on blue I would type:
-
- PROMPT $e[33;44m$p$g
-
- REMEMBER: For this to work, you must have ANSIPACH.SYS loaded. To
- do this, include it in your CONFIG.SYS file.
-
-
-
-
-
-
-
- C O M M A N D . C O M
-
-
- Here is a patch for DOS 3.2 CLS (clear screen) command. It will let
- you set the screen colors to whatever you wish, and it will also
- change the screen border color as well as the foreground and
- background text colors. I would prefer you use the ansi.sys patch
- which I describe above, but if you don't want ansi.sys loaded, and
- you don't think you will ever change your mind about what colors you
- wish to have, then I guess patching command.com is alright. I feel
- ansi.sys is more independent. When you are making this patch, be sure to
- make it on a COPY of the COMMAND.COM file. NEVER patch your original
- programs, you're just asking for trouble if you do. In this patch
- you will need to know the hexadecimal codes for the different screen
- colors. Here they are:
-
- 0 - Black 8 - Gray
- 1 - Blue 9 - Light Blue
- 2 - Green A - Light Green
- 3 - Cyan B - Light Cyann
- 4 - Red C - Light Red
- 5 - Magenta D - Light Magenta
- 6 - Brown E - Yellow
- 7 - White F - Bright White
-
- Patch your COMMAND.COM file by using the command -
-
- DEBUG COMMAND.COM
-
- Type the following:
-
- A 2818
- MOV AH,0B
- MOV BX,000<n> - Where <n> is the color (from the color chart
- INT 10 above) of the screen border color you wish to use.
- XOR CX,CX For example, MOV BX,0001 gives you a blue border.
- MOV AH,0F
- INT 10
- MOV BL,BH
- MOV DL,AH
- MOV DH,18
- MOV AX,0600
- MOV BH,<b><f> - Where <b> is the code for the background color you
- INT 10 want, and <f> is the color for the foreground.
- MOV BH,BL For example, MOV BH,17 would give you white on blue
- MOV AH,02 text, and MOV BH,1E would give you yellow on blue text.
- XOR DX,DX
- INT 10
- RET
- NOP
- - Press return on a blank line.
- W
- Q
-
-
- You are done patching DOS. You will have to reboot to see your
- changes go into effect.
-
-
-